<?
	
	include "../../xpert_database.php";
	
	xpert_database_connect($xpert_site);

	xpert_database_select($xpert_site);
	
	$response = xpert_database_multiple_select_query("select * from xpert_urls where url_status=\"fetch\"",$xpert_site);
	$counter = 0;
	
	while($url_feed = xpert_database_fetch_object_from_response($response)){
	
		echo $url_feed->url_address . "\n";
	
		$fh = fopen(getcwd() . "/sh/" . $counter++ . ".sh",'w');
		
		fwrite($fh,"wget --timeout=10 --tries=1 -O ../xml/" . ($counter-1) . ".xml '" . $url_feed->url_address . "'");
		
		fclose($fh);

		chmod(getcwd() . "/sh/" . ($counter-1) . ".sh", 0777);

		echo getcwd() . "/sh/" . ($counter-1) . ".sh<br>";
	
	}
		


?>